home *** CD-ROM | disk | FTP | other *** search
- /*************************************************************************
- *
- * ADOBE CONFIDENTIAL
- * ___________________
- *
- * Copyright 2000 Adobe Systems Incorporated
- * All Rights Reserved.
- *
- * NOTICE: All information contained herein is, and remains the property of
- * Adobe Systems Incorporated and its suppliers, if any. The intellectual
- * and technical concepts contained herein are proprietary to Adobe Systems
- * Incorporated a nd its suppliers and may be covered by U. S. and Foreign
- * Patents,patents in process,and are protected by trade secret or copyright
- * law. Dissemination of this information or reproduction of this material
- * is strictly forbidden unless prior written permission is obtained from
- * Adobe Systems Incorporated.
- *
- **************************************************************************/
-
- // ----------------------------------------------------------------
- // JSASample.c
- // Sample for the GoLive Extend Script SDK
- // requires the GoliveScript distribution order to compile
- // ----------------------------------------------------------------
-
- #include "JSA++.h"
-
- #include <math.h>
-
- #ifdef WIN32
- #include <windows.h>
- #else
- #include <QuickDraw.h>
- #endif
-
- // Implement this macro once to set up the necessary structures.
-
- JSA_INIT;
-
- // Return the power of arg1 to arg2.
-
- static void power(int argc, const sValue* argv[], sValue* returnValue)
- {
- double a = argv[0]->getDouble();
- double b = argv[1]->getDouble();
-
- double c = pow (a, b);
-
- returnValue->setDouble (c);
- }
-
- // Draw an oval into the given rectangle. This demonstrates the
- // use of the JSADrawInfo structure.
-
- static void drawOval(int argc, const sValue* argv[], sValue* returnValue)
- {
- int temp = argv[0]->getInteger();
- JSADrawInfo* info;
- #ifdef WIN32
- HDC dc;
- info = (JSADrawInfo*) temp;
- dc = (HDC) info->context;
- ::Ellipse (dc, info->left, info->top, info->right, info->bottom);
- #else
- info = (JSADrawInfo*) temp;
- Rect r;
- r.left = (short) info->left;
- r.top = (short) info->top;
- r.right = (short) info->right;
- r.bottom = (short) info->bottom;
- ::FrameOval (&r);
- #endif
- }
-
- // Implement the JSAMain function to register all callable functions.
-
- void JSAEXPORT JSAMain(void)
- {
- JSARegisterFunction("power",power);
- JSARegisterFunction("drawOval",drawOval);
- }
-
- // optional, may be omitted
-
- void JSAEXPORT JSAExit(void)
- {}
-